import { ALL, Body, Inject, Post, Provide } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { BaseSysDepartmentEntity } from '../../../entity/sys/department';
import { BaseSysDepartmentService } from '../../../service/sys/department';
import { SystemInfo } from '../../../service/sys/info';

/**
 * 系统配置
 */
@Provide()
@CoolController({

})
export class BaseInfoController extends BaseController {
    @Inject()
    systemInfo: SystemInfo;


    @Post('/info')
    async info() {
        return this.ok(await this.systemInfo.info());
    }

    @Post('/merchantOrderStatistics')
    async merchantOrderStatistics(
        @Body('page') page: number,
        @Body('size') size: number,
        @Body('startTime') startTime?: string,
        @Body('endTime') endTime?: string,
        @Body('keyword') keyword?: string,
        @Body('merchantId') merchantId?: number,
    ) {
        const p = Number(page) || 1;
        const s = Number(size) || 20;
        return this.ok(await this.systemInfo.merchantOrderStatistics(p, s, startTime, endTime, keyword, merchantId));
    }

     @Post('/agentOrderStatistics')
    async agentOrderStatistics(
        @Body('page') page: number,
        @Body('size') size: number,
        @Body('startTime') startTime?: string,
        @Body('endTime') endTime?: string,
        @Body('keyword') keyword?: string,
        @Body('merchantId') merchantId?: number,
    ) {
        const p = Number(page) || 1;
        const s = Number(size) || 20;
        return this.ok(await this.systemInfo.agentOrderStatistics(p, s, startTime, endTime, keyword, merchantId));
    }
}
